home *** CD-ROM | disk | FTP | other *** search
/ Workbench Design / WB Collection.iso / workbench werkzeuge / memory & system tools / vmm / developer / include / vmm_stat.h next >
C/C++ Source or Header  |  1996-04-07  |  3KB  |  106 lines

  1. #ifndef VMM_STAT_H
  2. #define VMM_STAT_H
  3.  
  4. #include <exec/types.h>
  5. #include <exec/tasks.h>
  6. #include <exec/ports.h>
  7.  
  8. /**********************************************************************/
  9. /*    Getting statistics messages from VMM for further processing     */
  10. /**********************************************************************/
  11.  
  12. struct VMStatMsg
  13.   {
  14.   struct Message VMMessage;   /* don't forget to put sizeof (struct VMStatMsg) */
  15.                               /* into mn_Length. Future version of VMM might   */
  16.                               /* extend this structure */
  17.   struct Task   *Sender;      
  18.   UWORD          Command;
  19.   UWORD          ReplySignal;
  20.   ULONG          VMSize;
  21.   ULONG          VMFree;
  22.   ULONG          Faults;
  23.   ULONG          PagesWritten;
  24.   ULONG          PagesRead;
  25.   ULONG          NumFrames;
  26.   ULONG          PagesUsed;
  27.   ULONG          PageSize;
  28.   ULONG          TrapStructsFree;
  29.   };
  30.  
  31. #define VMCMD_AskStat 1472
  32.  
  33. /* Do the following to get a statistics message from VMM:
  34.  * 
  35.  * struct VMStatMsg *StatMsg;
  36.  * LONG   VMSignal;
  37.  * struct MsgPort *VMPort;
  38.  *
  39.  * if ((StatMsg = AllocMem (sizeof (struct VMStatMsg), MEMF_PUBLIC)) == NULL)
  40.  *   Cleanup ();
  41.  *
  42.  * if ((VMSignal = AllocSignal (-1L)) == -1L)
  43.  *   Cleanup ();
  44.  *
  45.  * StatMsg->VMMessage.mn_Length = sizeof (struct VMStatMsg);
  46.  * StatMsg->Sender      = FindTask (NULL);
  47.  * StatMsg->Command     = VMCMD_AskStat;
  48.  * StatMsg->ReplySignal = VMSignal;
  49.  *
  50.  * Forbid ();
  51.  * if ((VMPort = FindPort ("VMM_Port")) != NULL)
  52.  *   PutMsg (VMPort, (struct Message*)StatMsg);
  53.  * else
  54.  *   ....
  55.  *
  56.  * Permit ();
  57.  * 
  58.  * Wait (1L << VMSignal);
  59.  *
  60.  * When this returns the StatMsg will contain the necessary parameters.
  61.  * Do whatever you like with it.
  62.  *
  63.  * Cleanup ();
  64.  *
  65.  * Easy, isn't it?
  66.  */
  67.  
  68. /**********************************************************************/
  69. /*                Getting VM usage statistics from VMM                */
  70. /**********************************************************************/
  71.  
  72. /* Send the following message structure to 'VMM_Port' just as a few lines
  73.  * above.
  74.  */
  75.  
  76. struct VMUsageMsg
  77.   {
  78.   struct Message VMMessage;   /* don't forget to put sizeof (struct VMStatMsg) */
  79.                               /* into mn_Length. Future version of VMM might   */
  80.                               /* extend this structure */
  81.   struct Task   *Sender;      
  82.   UWORD          Command;
  83.   UWORD          ReplySignal;
  84.   struct List   *TaskList;
  85.   };
  86.  
  87. /* Use this for the Command value */
  88.  
  89. #define VMCMD_AskVMUsage                1481
  90.  
  91. /* As soon as this returns, 'TaskList' will have been filled in. 
  92.  * 'TaskList' is a list of 'struct TaskVMUsage' described below.
  93.  * You can do whatever you like with the list, but as soon as you are
  94.  * finished you should call FreeMem for every 'struct TaskVMUsage'
  95.  * with a size of 'FreeSize' and for the List structure.
  96.  */
  97.  
  98. struct TaskVMUsage
  99.   {
  100.   struct Node vu_Node;
  101.   LONG   VMInUse;
  102.   ULONG  FreeSize;
  103.   };
  104.  
  105. #endif
  106.